POV-Ray : Newsgroups : povray.general : Domain error in pow : Re: Domain error in pow Server Time
10 Aug 2024 15:18:53 EDT (-0400)
  Re: Domain error in pow  
From: Chris Colefax
Date: 1 Dec 1999 22:06:50
Message: <3845e24a@news.povray.org>
Alf Peake wrote:
> /* Re my earlier post _Pinching points_ and responses by Chris Colefax
and
> Bill DeWitt:
> I get a non-fatal "Domain error in pow" each pass through the loop
below if
> in pow(A,B) B is not an integer and I use the D2 section. Both
sections
> should be the same and do evaluate the same. Is there a mistake in my
script
> that I'm missing? The docs say pow(float,float).

to which Jerome M. BERGER <jbe### [at] enstfr> replied:
> Yes but if the second number is not an integer, the first one must be
> greater than 0...
> The way I see it:
> * in the first example, PoV only evaluates the right #declare and the
> test ensures that the value is correct;
> * in the second example, PoV evaluates both values (or tries to) and
> then chooses according to the result of the test, which generates an
> error since one of the values is incorrect...

This is precisely the case, and so it would be correct (indeed,
necessary) to use the full #if () #declare ... #else #declare ... #end
syntax if you wanted to use non-integer powers (but I guess some of us
just can't resist a shortcut!).


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.